﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Controls_Job : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
             string strSQL = "select top 10 j_ID, case when len(j_Status)>5 then left(j_Status,5)+'' else j_Status end as j_Status,j_Company from ZhaoPin where  j_Lock=0 order by j_ID desc";
             SqlConnection conn = Class1.DBconnection();
             SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
             DataSet ds = new DataSet();
             da.Fill(ds);
             DataTable dt = ds.Tables[0];
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             {
                 if (ds.Tables[0].Rows[i]["j_Company"].ToString().Length > 10)
                 {
                     ds.Tables[0].Rows[i]["j_Company"] = ds.Tables[0].Rows[i]["j_Company"].ToString().Substring(0, 10).Trim() + "";
                 }
             }
             if (dt.Rows.Count > 0)
             {
                 dl_job.DataSource = ds.Tables[0];
                 dl_job.DataBind();
             }
             conn.Close();
             conn.Dispose();
             ds.Dispose();
             da.Dispose();
        }
    }

}
